Skip to content

hakerdefo/pmiab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

pmiab

pmiab (Poor Man's Internet Ad Blocker) is a simple bash script that blocks ads and other unwanted nasty stuff and makes surfing the ocean of Internet faster, better and safer experience. pmiab does this with the help of hosts file. Using hosts file to block ads has several distinct advantages over other ad-blocking methods.

Advantages :

  • No need to install and run any other applications.
  • Saves CPU, RAM and bandwidth.
  • Blocks IP calls on any port.
  • Faster web-page loading.
  • Enhances your privacy & security.
  • Hosts file can be edited in any text editor.
  • Works with any and every browser.

How does pmiab work?

pmiab downloads ad-blocking hosts files from the following sources,

  1. MPVS hosts file
  2. Dan Pollock's hosts file
  3. yoyo.org hosts file
  4. Badd Boyz hosts file
  5. Steven Black's hosts file
  6. ABUSE.ch hosts file
  7. AdAway hosts file

Then pmiab does some bash magic,

  • Creates a backup of original hosts file and sets it to read-only.
  • Removes MS-DOS carriage returns.
  • Removes all lines that don't begin with 127.0.0.1.
  • Removes any lines containing the word localhost.
  • Replaces 127.0.0.1 with 0.0.0.0.
  • Scrunches extraneous spaces into a single tab.
  • Removes any comments on lines.
  • Cleans leftover trailing blanks.
  • Removes duplicate entries.
  • Creates an ultimate ad-blocking hosts file.

Installation :

Installation is very simple. Download pmiab-master zip, extract its contents and copy the file pmiab to /usr/local/bin/ directory,

sudo cp pmiab /usr/local/bin/

And make it executable,

sudo chmod 755 /usr/local/bin/pmiab

Usage :

Since pmiab deals with the hosts file it needs to be run with sudo. Open terminal & run,

sudo pmiab

Or if you prefer su over sudo,

su -c pmiab

Then you can enable or disable advert blocking via a simple interactive menu of pmiab. To block the ads, select Block Internet Adverts option from the menu. Restart your browser if it is running, clean browser's cache and enjoy a smoother, safer and ad-free browsing. It is advised that you update the ad-blocking hosts file atleast once in a week. To update the ad-blocking hosts, you need to simply select Block Internet Adverts option from the menu.

Support :

If you like pmiab, please consider supporting it, even the smallest contribution goes a long way. It is quick & easy via PayPal, Buy Me a Coffee or Liberapay:

Support via PayPal
"Buy Me A Coffee"
Support via Liberapay

Credits :

  • Steve Riley : This script originally was a brainchild of Steve. Incredibly this was the first bash script he wrote.
  • Stuart Hanzlik : Stuarts articles on hosts file and its usage as ad blocker provided some valuable information.

License :

Public Domain Mark
This work (pmiab, by hakerdefo), identified by hakerdefo, is free of known copyright restrictions.